@@ -29,18 +29,31 @@ import butterknife.BindView; |
||
29 | 29 |
import butterknife.ButterKnife; |
30 | 30 |
import butterknife.OnClick; |
31 | 31 |
|
32 |
-public class BriefsActivity extends BaseActivity implements BriefsContract.View{ |
|
33 |
- |
|
34 |
- @BindView(R.id.tv_today_upload_num) TextView todayUploadNumText; |
|
35 |
- @BindView(R.id.tv_today_point_amount) TextView todayPointAmountText; |
|
36 |
- @BindView(R.id.tv_week_origin_sold_num) TextView weekOriginSoldNumText; |
|
37 |
- @BindView(R.id.tv_week_point_amount) TextView weekPointAmountText; |
|
38 |
- @BindView(R.id.switcher_order_msg) TextSwitcher orderMsgSwitch; |
|
39 |
- @BindView(R.id.switcher_system_msg) TextSwitcher systemMsgSwitch; |
|
40 |
- |
|
41 |
- @BindView(R.id.tv_current_price) TextView currentPriceText; |
|
42 |
- @BindView(R.id.rg_upload_settings) RadioGroup uploadDelayRadioGroup; |
|
43 |
- @BindView(R.id.toggle_upload_lock) ToggleButton uploadToggleBtn; |
|
32 |
+public class BriefsActivity extends BaseActivity implements BriefsContract.View { |
|
33 |
+ |
|
34 |
+ @BindView(R.id.tv_today_upload_num) |
|
35 |
+ TextView todayUploadNumText; |
|
36 |
+ @BindView(R.id.tv_today_point_amount) |
|
37 |
+ TextView todayPointAmountText; |
|
38 |
+ @BindView(R.id.tv_week_origin_sold_num) |
|
39 |
+ TextView weekOriginSoldNumText; |
|
40 |
+ @BindView(R.id.tv_week_point_amount) |
|
41 |
+ TextView weekPointAmountText; |
|
42 |
+ @BindView(R.id.switcher_order_msg) |
|
43 |
+ TextSwitcher orderMsgSwitch; |
|
44 |
+ @BindView(R.id.switcher_system_msg) |
|
45 |
+ TextSwitcher systemMsgSwitch; |
|
46 |
+ |
|
47 |
+ @BindView(R.id.tv_current_price) |
|
48 |
+ TextView currentPriceText; |
|
49 |
+ @BindView(R.id.rg_upload_settings) |
|
50 |
+ RadioGroup uploadDelayRadioGroup; |
|
51 |
+ @BindView(R.id.toggle_upload_lock) |
|
52 |
+ ToggleButton uploadToggleBtn; |
|
53 |
+ @BindView(R.id.toggle_energy_save) |
|
54 |
+ ToggleButton energySaveBtn; |
|
55 |
+ @BindView(R.id.tv_energy_save) |
|
56 |
+ TextView energySaveText; |
|
44 | 57 |
private BriefsPresenter presenter; |
45 | 58 |
|
46 | 59 |
@Override |
@@ -49,21 +62,21 @@ public class BriefsActivity extends BaseActivity implements BriefsContract.View{ |
||
49 | 62 |
setContentView(R.layout.activity_briefs); |
50 | 63 |
unbinder = ButterKnife.bind(this); |
51 | 64 |
int delay = Preferences.getInstance().getUploadDelay(); |
52 |
- if(delay==5){ |
|
65 |
+ if (delay == 5) { |
|
53 | 66 |
uploadDelayRadioGroup.check(R.id.rb_upload_fast); |
54 |
- }else if(delay==10){ |
|
67 |
+ } else if (delay == 10) { |
|
55 | 68 |
uploadDelayRadioGroup.check(R.id.rb_upload_normal); |
56 |
- }else { |
|
69 |
+ } else { |
|
57 | 70 |
uploadDelayRadioGroup.check(R.id.rb_upload_slow); |
58 | 71 |
} |
59 | 72 |
uploadDelayRadioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { |
60 | 73 |
@Override |
61 | 74 |
public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) { |
62 |
- if(checkedId==R.id.rb_upload_fast){ |
|
75 |
+ if (checkedId == R.id.rb_upload_fast) { |
|
63 | 76 |
Preferences.getInstance().setUploadDelay(5); |
64 |
- }else if(checkedId ==R.id.rb_upload_normal){ |
|
77 |
+ } else if (checkedId == R.id.rb_upload_normal) { |
|
65 | 78 |
Preferences.getInstance().setUploadDelay(10); |
66 |
- }else if(checkedId==R.id.rb_upload_slow){ |
|
79 |
+ } else if (checkedId == R.id.rb_upload_slow) { |
|
67 | 80 |
Preferences.getInstance().setUploadDelay(15); |
68 | 81 |
} |
69 | 82 |
} |
@@ -82,45 +95,54 @@ public class BriefsActivity extends BaseActivity implements BriefsContract.View{ |
||
82 | 95 |
uploadToggleBtn.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { |
83 | 96 |
@Override |
84 | 97 |
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
85 |
- Preferences.getInstance().setUploadInMobile(isChecked); |
|
98 |
+ Preferences.getInstance().setUploadInMobile(isChecked); |
|
99 |
+ } |
|
100 |
+ }); |
|
101 |
+ energySaveBtn.setChecked(Preferences.getInstance().isEnergySaveMode()); |
|
102 |
+ energySaveText.setText(Preferences.getInstance().isEnergySaveMode() ? R.string.energy_mode_on : R.string.energy_mode_off); |
|
103 |
+ energySaveBtn.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { |
|
104 |
+ @Override |
|
105 |
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
|
106 |
+ Preferences.getInstance().setEnergySaveMode(isChecked); |
|
107 |
+ energySaveText.setText(isChecked ? R.string.energy_mode_on : R.string.energy_mode_off); |
|
86 | 108 |
} |
87 | 109 |
}); |
88 | 110 |
orderMsgSwitch.setFactory(factory); |
89 | 111 |
systemMsgSwitch.setFactory(factory); |
90 |
- presenter = new BriefsPresenter(this,this); |
|
112 |
+ presenter = new BriefsPresenter(this, this); |
|
91 | 113 |
} |
92 | 114 |
|
93 | 115 |
@OnClick(R.id.switcher_order_msg) |
94 |
- public void clickOrderMsg(){ |
|
116 |
+ public void clickOrderMsg() { |
|
95 | 117 |
presenter.clickCurrentOrderMsg(); |
96 | 118 |
} |
97 | 119 |
|
98 | 120 |
@OnClick(R.id.switcher_system_msg) |
99 |
- public void clickSysMsg(){ |
|
121 |
+ public void clickSysMsg() { |
|
100 | 122 |
presenter.clickCurrentSysMsg(); |
101 | 123 |
} |
102 | 124 |
|
103 | 125 |
@OnClick(R.id.title_bar_back_layout) |
104 |
- void back(){ |
|
126 |
+ void back() { |
|
105 | 127 |
finish(); |
106 | 128 |
} |
107 | 129 |
|
108 | 130 |
@OnClick(R.id.iv_settings) |
109 |
- void goToSettingPage(){ |
|
131 |
+ void goToSettingPage() { |
|
110 | 132 |
MobclickAgent.onEvent(this, UmengEvent.brief_setting_btn_click); |
111 | 133 |
startActivity(new Intent(this, SettingsActivity.class)); |
112 | 134 |
} |
113 | 135 |
|
114 | 136 |
@OnClick(R.id.layout_price_setting) |
115 |
- void goToSetPrice(){ |
|
137 |
+ void goToSetPrice() { |
|
116 | 138 |
presenter.clickSettingPrice(); |
117 | 139 |
} |
118 | 140 |
|
119 | 141 |
@OnClick(R.id.layout_price_introduction) |
120 |
- void goToPriceIntroduction(){ |
|
121 |
- Intent intent = new Intent(this,WebViewActivity.class); |
|
142 |
+ void goToPriceIntroduction() { |
|
143 |
+ Intent intent = new Intent(this, WebViewActivity.class); |
|
122 | 144 |
intent.putExtra("url", UrlContainer.PLATFORM_PRICE_RULES_PAGE_URL); |
123 |
- intent.putExtra("title",getString(R.string.platform_price_rule)); |
|
145 |
+ intent.putExtra("title", getString(R.string.platform_price_rule)); |
|
124 | 146 |
startActivity(intent); |
125 | 147 |
} |
126 | 148 |
|
@@ -149,11 +171,11 @@ public class BriefsActivity extends BaseActivity implements BriefsContract.View{ |
||
149 | 171 |
systemMsgSwitch.post(new Runnable() { |
150 | 172 |
@Override |
151 | 173 |
public void run() { |
152 |
- if(orderMsgSwitch==null||systemMsgSwitch==null){ |
|
174 |
+ if (orderMsgSwitch == null || systemMsgSwitch == null) { |
|
153 | 175 |
return; |
154 | 176 |
} |
155 | 177 |
orderMsgSwitch.setText(TextUtils.isEmpty(orderMsg) ? getString(R.string.no_order_msg) : orderMsg); |
156 |
- systemMsgSwitch.setText(TextUtils.isEmpty(sysMsg) ? getString(R.string.no_system_msg): sysMsg); |
|
178 |
+ systemMsgSwitch.setText(TextUtils.isEmpty(sysMsg) ? getString(R.string.no_system_msg) : sysMsg); |
|
157 | 179 |
} |
158 | 180 |
}); |
159 | 181 |
|
@@ -81,6 +81,13 @@ public class Preferences { |
||
81 | 81 |
return mPrefs.getInt("delay",10); |
82 | 82 |
} |
83 | 83 |
|
84 |
+ public boolean isEnergySaveMode(){ |
|
85 |
+ return mPrefs.getBoolean("isEnergySaveMode",false); |
|
86 |
+ } |
|
87 |
+ |
|
88 |
+ public void setEnergySaveMode(boolean isEnergySaveMode){ |
|
89 |
+ mPrefs.edit().putBoolean("isEnergySaveMode",isEnergySaveMode).commit(); |
|
90 |
+ } |
|
84 | 91 |
public boolean isUploadInMobile(){ |
85 | 92 |
return mPrefs.getBoolean("uploadInMobile",true); |
86 | 93 |
} |
@@ -89,7 +96,6 @@ public class Preferences { |
||
89 | 96 |
mPrefs.edit().putBoolean("uploadInMobile",uploadInMobile).commit(); |
90 | 97 |
} |
91 | 98 |
|
92 |
- |
|
93 | 99 |
public void setCameraQueryInterval(int interval){ |
94 | 100 |
mPrefs.edit().putInt("interval",interval).commit(); |
95 | 101 |
} |
@@ -9,6 +9,7 @@ import android.support.v7.widget.LinearLayoutManager; |
||
9 | 9 |
import android.support.v7.widget.RecyclerView; |
10 | 10 |
import android.support.v7.widget.helper.ItemTouchHelper; |
11 | 11 |
import android.view.View; |
12 |
+import android.view.WindowManager; |
|
12 | 13 |
import android.widget.ImageView; |
13 | 14 |
import android.widget.TextView; |
14 | 15 |
import android.widget.Toast; |
@@ -25,6 +26,7 @@ import ai.pai.lensman.activities.SessionQRCodeActivity; |
||
25 | 26 |
import ai.pai.lensman.base.BaseActivity; |
26 | 27 |
import ai.pai.lensman.bean.PhotoBean; |
27 | 28 |
import ai.pai.lensman.bean.SessionBean; |
29 |
+import ai.pai.lensman.db.Preferences; |
|
28 | 30 |
import ai.pai.lensman.qrcode.QRCaptureActivity; |
29 | 31 |
import ai.pai.lensman.utils.UmengEvent; |
30 | 32 |
import ai.pai.lensman.views.ExitSessionConfirmPopup; |
@@ -32,22 +34,27 @@ import butterknife.BindView; |
||
32 | 34 |
import butterknife.ButterKnife; |
33 | 35 |
import butterknife.OnClick; |
34 | 36 |
|
35 |
-public class SessionActivity extends BaseActivity implements SessionContract.View ,View.OnClickListener{ |
|
37 |
+public class SessionActivity extends BaseActivity implements SessionContract.View, View.OnClickListener { |
|
36 | 38 |
|
37 |
- @BindView(R.id.icon_no_data) View noPhotoLayout; |
|
38 |
- @BindView(R.id.title_bar_middle_txt) TextView titleTextView; |
|
39 |
- @BindView(R.id.recycler_view_photos) RecyclerView photosRecyclerView; |
|
40 |
- @BindView(R.id.iv_scan) ImageView qrcodeScanBtn; |
|
41 |
- @BindView(R.id.tv_camera_status) TextView cameraStatusTextView; |
|
39 |
+ @BindView(R.id.icon_no_data) |
|
40 |
+ View noPhotoLayout; |
|
41 |
+ @BindView(R.id.title_bar_middle_txt) |
|
42 |
+ TextView titleTextView; |
|
43 |
+ @BindView(R.id.recycler_view_photos) |
|
44 |
+ RecyclerView photosRecyclerView; |
|
45 |
+ @BindView(R.id.iv_scan) |
|
46 |
+ ImageView qrcodeScanBtn; |
|
47 |
+ @BindView(R.id.tv_camera_status) |
|
48 |
+ TextView cameraStatusTextView; |
|
42 | 49 |
|
43 | 50 |
private PhotoRecyclerAdapter adapter; |
44 |
- private SessionBean sessionBean; |
|
51 |
+ private SessionBean sessionBean; |
|
45 | 52 |
private SessionContract.Presenter presenter; |
46 | 53 |
private static final int JOIN_REQUEST_CODE = 3002; |
47 | 54 |
|
48 | 55 |
private boolean isBackground; |
49 | 56 |
|
50 |
- private ItemTouchHelper.Callback mCallback = new ItemTouchHelper.SimpleCallback(ItemTouchHelper.UP | ItemTouchHelper.DOWN, ItemTouchHelper.RIGHT|ItemTouchHelper.LEFT) { |
|
57 |
+ private ItemTouchHelper.Callback mCallback = new ItemTouchHelper.SimpleCallback(ItemTouchHelper.UP | ItemTouchHelper.DOWN, ItemTouchHelper.RIGHT | ItemTouchHelper.LEFT) { |
|
51 | 58 |
|
52 | 59 |
@Override |
53 | 60 |
public void onChildDraw(Canvas c, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) { |
@@ -63,13 +70,13 @@ public class SessionActivity extends BaseActivity implements SessionContract.Vie |
||
63 | 70 |
public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) { |
64 | 71 |
int position = viewHolder.getAdapterPosition(); |
65 | 72 |
PhotoBean photoBean = adapter.getPhotoAt(position); |
66 |
- if(photoBean==null){ |
|
73 |
+ if (photoBean == null) { |
|
67 | 74 |
return; |
68 | 75 |
} |
69 |
- if(photoBean.canDelete){ |
|
76 |
+ if (photoBean.canDelete) { |
|
70 | 77 |
presenter.swipeToDeletePhoto(position); |
71 | 78 |
adapter.removePhotoAtIndex(position); |
72 |
- }else{ |
|
79 |
+ } else { |
|
73 | 80 |
showToast(getString(R.string.can_not_delete)); |
74 | 81 |
} |
75 | 82 |
} |
@@ -80,15 +87,15 @@ public class SessionActivity extends BaseActivity implements SessionContract.Vie |
||
80 | 87 |
super.onCreate(savedInstanceState); |
81 | 88 |
setContentView(R.layout.activity_session); |
82 | 89 |
unbinder = ButterKnife.bind(this); |
83 |
- sessionBean =(SessionBean)getIntent().getSerializableExtra("session"); |
|
84 |
- if(BuildConfig.isTestMode){ |
|
85 |
- sessionBean.sessionId="test"; |
|
90 |
+ sessionBean = (SessionBean) getIntent().getSerializableExtra("session"); |
|
91 |
+ if (BuildConfig.isTestMode) { |
|
92 |
+ sessionBean.sessionId = "test"; |
|
86 | 93 |
} |
87 |
- if(BuildConfig.DEBUG){ |
|
94 |
+ if (BuildConfig.DEBUG) { |
|
88 | 95 |
cameraStatusTextView.setVisibility(View.VISIBLE); |
89 | 96 |
} |
90 |
- presenter = new SessionPresenter(sessionBean,this); |
|
91 |
- titleTextView.setText(getString(R.string.scene,sessionBean.sessionSeq)); |
|
97 |
+ presenter = new SessionPresenter(sessionBean, this); |
|
98 |
+ titleTextView.setText(getString(R.string.scene, sessionBean.sessionSeq)); |
|
92 | 99 |
adapter = new PhotoRecyclerAdapter(this); |
93 | 100 |
|
94 | 101 |
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this); |
@@ -101,9 +108,9 @@ public class SessionActivity extends BaseActivity implements SessionContract.Vie |
||
101 | 108 |
presenter.start(); |
102 | 109 |
String LOG_PATH = Environment.getExternalStorageDirectory() |
103 | 110 |
.getAbsolutePath() + "/lensman/logs/"; |
104 |
- if(!new File(LOG_PATH).exists()&&!new File(LOG_PATH).mkdirs()){ |
|
105 |
- LogHelper.d("czy","sdcard write file error"); |
|
106 |
- Toast.makeText(this,R.string.sdcard_fail,Toast.LENGTH_SHORT).show(); |
|
111 |
+ if (!new File(LOG_PATH).exists() && !new File(LOG_PATH).mkdirs()) { |
|
112 |
+ LogHelper.d("czy", "sdcard write file error"); |
|
113 |
+ Toast.makeText(this, R.string.sdcard_fail, Toast.LENGTH_SHORT).show(); |
|
107 | 114 |
} |
108 | 115 |
} |
109 | 116 |
|
@@ -111,12 +118,16 @@ public class SessionActivity extends BaseActivity implements SessionContract.Vie |
||
111 | 118 |
protected void onResume() { |
112 | 119 |
super.onResume(); |
113 | 120 |
isBackground = false; |
121 |
+ if(!Preferences.getInstance().isEnergySaveMode()){ |
|
122 |
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); |
|
123 |
+ } |
|
114 | 124 |
} |
115 | 125 |
|
116 | 126 |
@Override |
117 | 127 |
protected void onPause() { |
118 | 128 |
super.onPause(); |
119 | 129 |
isBackground = true; |
130 |
+ getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); |
|
120 | 131 |
} |
121 | 132 |
|
122 | 133 |
@Override |
@@ -126,7 +137,7 @@ public class SessionActivity extends BaseActivity implements SessionContract.Vie |
||
126 | 137 |
} |
127 | 138 |
|
128 | 139 |
@OnClick(R.id.iv_scan) |
129 |
- void scanToFetchSessionQR(){ |
|
140 |
+ void scanToFetchSessionQR() { |
|
130 | 141 |
MobclickAgent.onEvent(this, UmengEvent.session_scan_qr_btn_click); |
131 | 142 |
Intent intent = new Intent(SessionActivity.this, QRCaptureActivity.class); |
132 | 143 |
startActivityForResult(intent, JOIN_REQUEST_CODE); |
@@ -134,22 +145,22 @@ public class SessionActivity extends BaseActivity implements SessionContract.Vie |
||
134 | 145 |
} |
135 | 146 |
|
136 | 147 |
@OnClick(R.id.iv_qrcode) |
137 |
- void showQRCodeForSession(){ |
|
148 |
+ void showQRCodeForSession() { |
|
138 | 149 |
MobclickAgent.onEvent(this, UmengEvent.session_view_qr_btn_click); |
139 |
- Intent intent = new Intent(this,SessionQRCodeActivity.class); |
|
140 |
- intent.putExtra("qrcode",sessionBean.sessionId); |
|
150 |
+ Intent intent = new Intent(this, SessionQRCodeActivity.class); |
|
151 |
+ intent.putExtra("qrcode", sessionBean.sessionId); |
|
141 | 152 |
startActivity(intent); |
142 | 153 |
} |
143 | 154 |
|
144 | 155 |
@OnClick(R.id.title_bar_back_layout) |
145 |
- void backToMain(){ |
|
146 |
- new ExitSessionConfirmPopup(this,this).showPopupWindow(); |
|
156 |
+ void backToMain() { |
|
157 |
+ new ExitSessionConfirmPopup(this, this).showPopupWindow(); |
|
147 | 158 |
} |
148 | 159 |
|
149 | 160 |
@OnClick(R.id.btn_session_complete) |
150 |
- void onSessionComplete(){ |
|
161 |
+ void onSessionComplete() { |
|
151 | 162 |
MobclickAgent.onEvent(this, UmengEvent.session_finish_btn_click); |
152 |
- new ExitSessionConfirmPopup(this,this).showPopupWindow(); |
|
163 |
+ new ExitSessionConfirmPopup(this, this).showPopupWindow(); |
|
153 | 164 |
} |
154 | 165 |
|
155 | 166 |
@Override |
@@ -157,7 +168,7 @@ public class SessionActivity extends BaseActivity implements SessionContract.Vie |
||
157 | 168 |
photosRecyclerView.post(new Runnable() { |
158 | 169 |
@Override |
159 | 170 |
public void run() { |
160 |
- LogHelper.d(TAG,"addNewPhoto to UI "+bean); |
|
171 |
+ LogHelper.d(TAG, "addNewPhoto to UI " + bean); |
|
161 | 172 |
adapter.addPhotoBean(bean); |
162 | 173 |
photosRecyclerView.smoothScrollToPosition(0); |
163 | 174 |
} |
@@ -193,14 +204,14 @@ public class SessionActivity extends BaseActivity implements SessionContract.Vie |
||
193 | 204 |
|
194 | 205 |
@Override |
195 | 206 |
public void showToast(final String toast) { |
196 |
- if(isBackground){ |
|
207 |
+ if (isBackground) { |
|
197 | 208 |
return; |
198 | 209 |
} |
199 |
- if(photosRecyclerView!=null){ |
|
210 |
+ if (photosRecyclerView != null) { |
|
200 | 211 |
photosRecyclerView.post(new Runnable() { |
201 | 212 |
@Override |
202 | 213 |
public void run() { |
203 |
- Toast.makeText(SessionActivity.this,toast,Toast.LENGTH_SHORT).show(); |
|
214 |
+ Toast.makeText(SessionActivity.this, toast, Toast.LENGTH_SHORT).show(); |
|
204 | 215 |
} |
205 | 216 |
}); |
206 | 217 |
} |
@@ -210,7 +221,7 @@ public class SessionActivity extends BaseActivity implements SessionContract.Vie |
||
210 | 221 |
|
211 | 222 |
@Override |
212 | 223 |
public void refreshRecyclerView() { |
213 |
- if(adapter!=null && photosRecyclerView!=null && photosRecyclerView.getVisibility()==View.VISIBLE){ |
|
224 |
+ if (adapter != null && photosRecyclerView != null && photosRecyclerView.getVisibility() == View.VISIBLE) { |
|
214 | 225 |
photosRecyclerView.post(new Runnable() { |
215 | 226 |
@Override |
216 | 227 |
public void run() { |
@@ -222,25 +233,25 @@ public class SessionActivity extends BaseActivity implements SessionContract.Vie |
||
222 | 233 |
|
223 | 234 |
@Override |
224 | 235 |
public void addPhotos(final ArrayList<PhotoBean> photoList) { |
225 |
- if(photoList==null||photoList.size()<1) { |
|
236 |
+ if (photoList == null || photoList.size() < 1) { |
|
226 | 237 |
return; |
227 | 238 |
} |
228 | 239 |
photosRecyclerView.post(new Runnable() { |
229 | 240 |
@Override |
230 | 241 |
public void run() { |
231 | 242 |
adapter.addPreviousPhotos(photoList); |
232 |
- photosRecyclerView.smoothScrollToPosition(photoList.size()-1); |
|
243 |
+ photosRecyclerView.smoothScrollToPosition(photoList.size() - 1); |
|
233 | 244 |
} |
234 | 245 |
}); |
235 | 246 |
} |
236 | 247 |
|
237 | 248 |
@Override |
238 | 249 |
public void refreshCameraStatus(final String status) { |
239 |
- if(cameraStatusTextView!=null){ |
|
250 |
+ if (cameraStatusTextView != null) { |
|
240 | 251 |
cameraStatusTextView.post(new Runnable() { |
241 | 252 |
@Override |
242 | 253 |
public void run() { |
243 |
- if(cameraStatusTextView!=null){ |
|
254 |
+ if (cameraStatusTextView != null) { |
|
244 | 255 |
cameraStatusTextView.setText(status); |
245 | 256 |
} |
246 | 257 |
} |
@@ -250,16 +261,16 @@ public class SessionActivity extends BaseActivity implements SessionContract.Vie |
||
250 | 261 |
|
251 | 262 |
@Override |
252 | 263 |
protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
253 |
- super.onActivityResult(requestCode,resultCode,data); |
|
264 |
+ super.onActivityResult(requestCode, resultCode, data); |
|
254 | 265 |
if (resultCode == Activity.RESULT_OK) { |
255 | 266 |
if (data == null || data.getStringExtra("info") == null) { |
256 | 267 |
return; |
257 | 268 |
} |
258 | 269 |
String qrInfo = data.getStringExtra("info"); |
259 |
- if(qrInfo.contains("pai.ai/g/")||qrInfo.contains("xfoto.com.cn/g/")){ |
|
260 |
- String groupId = qrInfo.substring(qrInfo.lastIndexOf("/")+1); |
|
270 |
+ if (qrInfo.contains("pai.ai/g/") || qrInfo.contains("xfoto.com.cn/g/")) { |
|
271 |
+ String groupId = qrInfo.substring(qrInfo.lastIndexOf("/") + 1); |
|
261 | 272 |
presenter.addSessionPhotos2Group(groupId); |
262 |
- }else{ |
|
273 |
+ } else { |
|
263 | 274 |
presenter.change2QRCodeSessionId(data.getStringExtra("info")); |
264 | 275 |
} |
265 | 276 |
} |
@@ -267,7 +278,7 @@ public class SessionActivity extends BaseActivity implements SessionContract.Vie |
||
267 | 278 |
|
268 | 279 |
@Override |
269 | 280 |
public void onClick(View view) { |
270 |
- if(view.getId()==R.id.btn_exit_session_confirm){ |
|
281 |
+ if (view.getId() == R.id.btn_exit_session_confirm) { |
|
271 | 282 |
presenter.stop(); |
272 | 283 |
finish(); |
273 | 284 |
} |
@@ -275,7 +286,7 @@ public class SessionActivity extends BaseActivity implements SessionContract.Vie |
||
275 | 286 |
|
276 | 287 |
@Override |
277 | 288 |
public void onBackPressed() { |
278 |
- new ExitSessionConfirmPopup(this,this).showPopupWindow(); |
|
289 |
+ new ExitSessionConfirmPopup(this, this).showPopupWindow(); |
|
279 | 290 |
} |
280 | 291 |
|
281 | 292 |
|
@@ -394,6 +394,41 @@ |
||
394 | 394 |
android:textOn="@null" /> |
395 | 395 |
|
396 | 396 |
</LinearLayout> |
397 |
+ <View |
|
398 |
+ android:layout_width="match_parent" |
|
399 |
+ android:layout_height="1px" |
|
400 |
+ android:background="@color/text_hint_grey_color" /> |
|
401 |
+ |
|
402 |
+ <LinearLayout |
|
403 |
+ android:layout_width="match_parent" |
|
404 |
+ android:layout_height="32dp" |
|
405 |
+ android:orientation="horizontal"> |
|
406 |
+ |
|
407 |
+ <TextView |
|
408 |
+ android:id="@+id/tv_energy_save" |
|
409 |
+ android:layout_width="0dp" |
|
410 |
+ android:layout_weight="1" |
|
411 |
+ android:layout_height="wrap_content" |
|
412 |
+ android:layout_gravity="center_vertical|left" |
|
413 |
+ android:paddingLeft="10dp" |
|
414 |
+ android:text="@string/energy_mode_off" |
|
415 |
+ android:textColor="@color/_7B8088" |
|
416 |
+ android:textSize="14sp" /> |
|
417 |
+ |
|
418 |
+ <ToggleButton |
|
419 |
+ android:id="@+id/toggle_energy_save" |
|
420 |
+ android:layout_width="56dp" |
|
421 |
+ android:layout_height="20dp" |
|
422 |
+ android:layout_marginRight="12dp" |
|
423 |
+ android:layout_gravity="center_vertical" |
|
424 |
+ android:background="@drawable/toggle_button_selector" |
|
425 |
+ android:checked="false" |
|
426 |
+ android:gravity="center" |
|
427 |
+ android:textColor="@color/white" |
|
428 |
+ android:textOff="@null" |
|
429 |
+ android:textOn="@null" /> |
|
430 |
+ |
|
431 |
+ </LinearLayout> |
|
397 | 432 |
|
398 | 433 |
|
399 | 434 |
</LinearLayout> |
@@ -142,6 +142,8 @@ |
||
142 | 142 |
<string name="logout_user">退出登录</string> |
143 | 143 |
|
144 | 144 |
<string name="upload_in_mobile_network">运营商网络下自动上传</string> |
145 |
+ <string name="energy_mode_on">节能模式已开启</string> |
|
146 |
+ <string name="energy_mode_off">节能模式已关闭</string> |
|
145 | 147 |
|
146 | 148 |
<string name="can_not_delete">该照片已在上传队列,无法删除</string> |
147 | 149 |
<string name="auto_upload_after_seconds">距加入上传队列还有%d秒</string> |